import Button from "components/Base/Button";
import Icon from "components/Base/Icon";
import DataTable from "components/Base/DataTable";
import {getEcgDeviceType} from "../../../../models/deviceType";

export default (self) => [
  {
    title: 'id',
    name: 'id',
    formItem: {
      type: 'hidden'
    },
  },
  {
    title: '设备ID',
    name: 'numeration',
    tableItem: {
      sorter: true,
    },
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入设备ID'
        }
      ]
    },
  },

  {
    title: '心电型号',
    name: 'deviceType',
    dict: [
      {code: 'ECG_DEVICE', codeName: 'mlnx心电'},
      {code: 'MP_DEVICE', codeName: '多参心电'},
    ],
    tableItem: {},
    formItem: {
      type: 'select',
      rules: [
        {
          required: true,
          message: '请选择心电型号'
        }
      ]
    }
  },
  {
    title: '运行模式',
    name: 'ecgDeviceRunMode',
    tableItem: {
      filters: [
        {
          value: 'DIAGNOSIS_MODE',
          text: '诊断监护',
        },
        {
          value: 'STANDARD_MODE',
          text: '标准监护',
        },
        {
          value: 'SPORT_MODE',
          text: '运动监护模式',
        },
      ]
    },
    dict: [
      {
        code: 'DIAGNOSIS_MODE',
        codeName: '诊断监护',
      },
      {
        code: 'STANDARD_MODE',
        codeName: '标准监护',
      },
      {
        code: 'SPORT_MODE',
        codeName: '运动监护模式',
      },
    ],
    formItem: {
      type: 'select',
      rules: [
        {
          required: true,
          message: '请选择设备运行模式'
        }
      ]
    }
  },
  {
    title: '通道模式',
    name: 'ecgChannelType',
    tableItem: {},
    dict: [
      {code: 'CHAN_8', codeName: '8通道'},
      {code: 'CHAN_3', codeName: '3通道'},
      {code: 'CHAN_1', codeName: '1通道'},
    ],
    formItem: {
      type: 'select',
      rules: [
        {
          required: true,
          message: '请选择设备通道模式'
        }
      ]
    }
  },
  {
    title: 'cpuId',
    name: 'cpuId',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入cpuid'
        }
      ]
    }
  },
  {
    title: '绑定患者',
    name: 'patientId',
    tableItem: {},
    formItem: {}
  },
  {
    title: '状态',
    name: 'state',
    tableItem: {
      filters: [
        {
          value: 'online',
          text: '在线',
        },
        {
          value: 'offline',
          text: '离线',
        },
      ]
    },
    formItem: {
      type: 'hidden'
    }
  },

  {
    title: '操作',
    tableItem: {
      width: 180,
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit"/>
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash"/>
          </Button>
        </DataTable.Oper>
      )
    }
  }
]
